import java.util.List;
/**
 * 
 * Class to represent a user on the program (whether logged in or
 * not, and if yes - hold his data gathered from the DB)
 *
 */
public class UserState {
	private boolean loggedin;
	private int id;
	private int sex;
	private int genre;
	private int age;
	private int continent;
	private List<SongUID> likes;
	
	public UserState() {
		this.loggedin=false;
	}
	public UserState(boolean loggedin) {
		this.loggedin=loggedin;
	}
	
	public UserState(boolean loggedin, int id) {
		this(loggedin);
		this.id=id;
	}
	
	public void setLoggedin(boolean loggedin) {
		this.loggedin = loggedin;
	}
	public boolean isLoggedin() {
		return loggedin;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getId() {
		return id;
	}
	public void setSex(int sex) {
		this.sex = sex;
	}
	public int getSex() {
		return sex;
	}
	public void setGenre(int genre) {
		this.genre = genre;
	}
	public int getGenre() {
		return genre;
	}
	public void setContinent(int continent) {
		this.continent = continent;
	}
	public int getContinent() {
		return continent;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public int getAge() {
		return age;
	}
	public void setLikes(List<SongUID> likes) {
		this.likes = likes;
	}
	public List<SongUID> getLikes() {
		return likes;
	}
	public int inList(SongUID id) {
		int index=-1;
		
		for (SongUID currSongUID : this.likes) {
			if (currSongUID.equals(id)) {
				index=this.likes.indexOf(currSongUID);
				break;
			}
		}
		return index;
	}
	public void InsertToLikes(SongUID id) {
		this.likes.add(id);
	}
	public void RemoveFromLikes(SongUID id) {
		int index=-1;
		
		index=inList(id);
		if (index>=0) {
			this.likes.remove(index);
		}
	}
	
}
